<template>
	<div>
		<el-table :data="resourcebacks" border>
			<el-table-column prop="user.name" label="访问用户" align='center' width='150' />
			<el-table-column prop="user.deptName" label="组织机构" align='center' />
			<el-table-column prop="startTime" label="访问时间" align='center' width='270' />
			<el-table-column prop="ip" label="访问IP" align='center' />
			<el-table-column prop="address" label="地址" align='center' />
		</el-table>
		<div style="width: 100%;margin: 15px;text-align: center;">
			<el-pagination background @current-change="handleCurrentChange" :current-page="current" layout="total, prev, pager, next, jumper" :total="total"></el-pagination>
		</div>
	</div>
</template>

<script>
	import { simulationOpenList } from "@/api/simulation.js"
	export default {
		props: {
			resourceId: {
				type: String,
				default: ''
			},
		},
		data() {
			return {
				resourcebacks: [],
				current: 1,
				limit: 10,
				total: 0,
			};
		},
		created() {
			this.getResourceInfo();
		},
		methods: {
			getResourceInfo() {
				var data = {
					limit: this.limit,
					current: this.current,
					resourceId: this.resourceId,
				}
				simulationOpenList(data).then(res => {
					this.resourcebacks = res.data.records;
					this.total = res.data.total;
				})
			},
			handleCurrentChange(current) {
				this.current = current;
				this.getResourceInfo();
			},
		}
	};
</script>